const interfaces = require('../../utils/urlconfig')
Page({

  /**
   * 页面的初始数据
   */
  data: {
    navLeftItems:[
      "热门推荐","计算机","小语种","英语",
      "人工智能","职场成长","人文社科","理科","工科",
      "龙哥秘籍","龙哥专用道具","经济","算法"
    ],
    navRightItems:[
      { 
        title:"热门推荐",
        desc:{img:["/images/logos/Vue.png","/images/logos/Vue.png","/images/logos/Vue.png","/images/logos/Vue.png"],
              text:["Vue","Vue"]    
            },
        
      },
      { 
        title:"abc",
        desc:{img:["/images/logos/Vue.png","/images/logos/Vue.png"],
              text:["Vue","Vue"]    
            },
      },

    ],
    curIndex:0
  },

  showListView(e){
    // console.log(e)
    let txt = e.currentTarget.dataset.txt
    console.log(txt)
    wx.navigateTo({
      url: '/pages/list/index?title='+txt,
    })
  },
  switchTab(e){
    // console.log(e)
    const index = parseInt(e.currentTarget.dataset.index)
    this.setData({
      curIndex:index
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    // const self = this
    wx.showLoading({
      title: '龙哥准备中...',
    })
    wx.request({
      url: interfaces.categoryPage,
      header:{
        "content-type":"application/json"
      },
      success(res){
        // self.setData({
        //   navLeftItems:res.data.navLeftItems,
        //   navRightItems:res.data.navRightItems
        // })
        wx.hideLoading()
      },
      fail(aka){
        wx.hideLoading()
      }
    })
  }
})